#!/bin/bash  
  
# # 定义要ping的服务器或IP地址  
# PING_TARGET="www.baidu.com"  
  
# # 定义等待时间和尝试次数  
# MAX_RETRIES=30  
# RETRY_INTERVAL=5  # 秒  
# RETRY_COUNT=0  
  
# # 等待网络连接正常  
# until ping -c 1 $PING_TARGET > /dev/null 2>&1; do  
#     echo "Waiting for network connection... ($((RETRY_COUNT+1))/$MAX_RETRIES)"  
#     sleep $RETRY_INTERVAL  
#     ((RETRY_COUNT++))  
  
#     if [ $RETRY_COUNT -eq $MAX_RETRIES ]; then  
#         echo "Network connection check failed after $MAX_RETRIES attempts."  
#         exit 1  
#     fi  
# done  
  
# echo "Network connection is up."  
  
# 在这里继续你的脚本逻辑...
# gnome-terminal --command='bash -c "echo Hello, World!;cd theyn;cd mqtt_client;exec bash"'
gnome-terminal --command='bash -c "echo Hello, World!;cd theyn;cd mqtt_client;sudo ip link set can0 up type can bitrate 500000;sudo chmod 666 /dev/ttyS*;python main.py; exec bash"'
# python3 tcp_client.py
bash
